<!--
 * @Author: 孙开源 && sunkaiyuan@namenode.cn
 * @Date: 2023-02-07 08:50:23
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @LastEditTime: 2023-07-15 16:11:56
 * @Description: 
 * 
-->
<template>
  <el-dialog
    :title="'扫码'"
    v-model="visible"
    :width="400"
    destroy-on-close
    @closed="$emit('closed')"
  >
    <div class="qrCodeLogin">
      <sc-qr-code :text="text" :size="200"></sc-qr-code>
    </div>
  </el-dialog>
</template>

<script>
//   import lumenPusher from '@/utils/lumenPusher';
export default {
  emits: ["success", "closed"],
  props: {
    text: { type: String, default: "" },
  },
  data() {
    return {
      wsMessage: null,
      visible: false,
    };
  },
  mounted() {
    this.$WS.off("UploadFileEvent");
    this.$WS.on("UploadFileEvent", (data) => {
      this.$emit("success", data);
    });
  },
  created() {},
  methods: {
    open() {
      this.visible = true;
      return this;
    },
    beforeDestroy() {
      this.$WS.off("UploadFileEvent");
    },
  },
};
</script>

<style>
.qrCodeLogin {
  text-align: center;
  position: relative;
  padding: 20px 0;
}
</style>
